import request from '@/utils/request'
import { LOGIN } from '../actionTypes'

export const login = ({ mobile, code }) => {
  return async (dispatch) => {
    const res = await request({
      method: 'post',
      url: '/authorizations',
      data: { mobile, code }
    })
    console.log(res)
    dispatch({
      type: LOGIN,
      payload: res.data.token
    })
  }
}
